
var api = require('../../utils/api.js')


Page({

    /**
     * 页面的初始数据
     */
    data: {
        start_t:'',
        end_t:'',
        info:[]
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        api.post({
            url: 'ranking/getdate',
            data: {},
            success: data => {
                this.setData({
                    start_t:data.data.a,
                    end_t:data.data.b
                })

                this.getdatainfo();
            }
        });

    },


    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        
    },

    bindDateChangea(ret){

        this.setData({
            start_t:ret.detail.value
        })

        this.getdatainfo();

    },

    bindDateChangeb(ret){
        this.setData({
            end_t:ret.detail.value
        })

        this.getdatainfo();
    },

    getdatainfo(){

        var statrtime=this.data.start_t;
        var endtime=this.data.end_t;
        var that=this;

        api.post({
            url: 'ranking/getalldatebytime',
            data: {statrtime:statrtime,endtime:endtime},
            success: data => {
                that.setData({
                    info:data.data
                })
            }
        });

    }

})